package edu.udo.sopra10.chaturaji.events;

import java.util.ArrayList;

import edu.udo.sopra10.chaturaji.entities.Player;
import edu.udo.sopra10.chaturaji.entities.Turn;

public class PassEvent extends ChaturajiEvent
{
	private static final long serialVersionUID = 2084921074306226574L;
	
	private int turnNumber;
	private byte playerId;
	private int fullScore;
	private ArrayList<Byte> diceRolls;
	
	public PassEvent ( Object source, Turn turn )
	{
		super( source );
		
		Player player = turn.getPlayer();
		
		// copy data from turn
		turnNumber = player.getGame().getHistory().indexOf( turn );
		playerId = player.getTurnOrderPosition();
		fullScore = player.getScore();
		diceRolls = new ArrayList<Byte>( turn.getUnassignedRolls() );
	}
	
	/**
	 * Returns the current turn number.
	 * 
	 * @return the turn number.
	 */
	public int getTurnNumber ()
	{
		return turnNumber;
	}
	
	/**
	 * Returns the id of the current player.
	 * 
	 * @return the player id.
	 */
	public byte getPlayerId ()
	{
		return playerId;
	}
	
	/**
	 * Returns the full score of the player after his move.
	 * 
	 * @return the full score.
	 */
	public int getFullScore ()
	{
		return fullScore;
	}
	
	/**
	 * Returns a collection of all passed dice rolls.
	 * 
	 * @return the passed rolls.
	 */
	public ArrayList<Byte> getDiceRolls ()
	{
		return diceRolls;
	}
	
	/**
	 * Returns the number of passed moves.
	 * 
	 * @return number of passed moves.
	 */
	public int getPassedMoveCount ()
	{
		return diceRolls.size();
	}
}